import os
import glob
import sys
import argparse
import math
import random
import copy

# os
# dir(os)
# help(os)
file_name = os.path.join('.', 'buildins.py')
print(file_name)
print(os.environ['PYTHONPATH'])
print('*' * 10)

# glob
files = glob.glob('*.py')
print(files)
print('*' * 10)

# sys
print(sys.argv)
print('*' * 10)

# argparse
parser = argparse.ArgumentParser(description='Show top lines from each file')
parser.add_argument('-filenames', default='alpha.txt')
parser.add_argument('-l', '--lines', type=int, default=10)
args = parser.parse_args()
print(args)
print('*' * 10)
# python buildins.py --lines=5 alpha.txt

# math
print(math.pow(2, 5))
print(math.sqrt(17))
print('*' * 10)

# random
r1 = random.choice(['apple', 'pear', 'banana'])
print(r1)
r2 = random.sample(range(100), 10)   # sampling without replacement
print(r2)
r3 = random.random()    # random float
print(r3)
r4 = random.randrange(6)    # random integer chosen from range(6)
print(r4)
print('*' * 10)

# copy
my_list = [0, 1, 2]
copy_list = copy.copy(my_list)
deepcopy_list = copy.deepcopy(my_list)
copy_list[1] = 4
print(my_list)
print(copy_list)
print(deepcopy_list)
print('*' * 10)

c1 = [[2, 2], [3, 3]]
c2 = copy.copy(c1)
c3 = copy.deepcopy(c1)
c2[0][1] = 4
print(c1)
print(c2)
print(c3)
